package org.example.context.event;

import org.example.context.ApplicationEvent;
import org.example.context.ApplicationListener;
import org.example.factory.BeanFactory;

import java.util.Collection;

/**
 * @Author: luyg
 * @Date: 2024/09/13/20:10
 * @Description:
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster{

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @Override
    public void multicastEvent(ApplicationEvent applicationEvent) {
        for (ApplicationListener applicationListener : getApplicationLister(applicationEvent)) {
            applicationListener.onApplicationEvent(applicationEvent);
        }
    }
}
